%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                               %
%                       Legal Notice                            %
%                                                               %
% This document is copyright (C) Olaf Kirch, okir@monad.swb.de  %
%                                                               %
% For copying conditions, please refer to the file COPYING.	%
%                                                               %
% The author is not liable for any damages, direct or indirect, %
% resulting from the use of information provided in this        %
% document.                                                     %
%                                                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% When viewing this document with vi on an 80-columns screen,   %
% do a ':se nonumber' first.                                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                               %
%               S T A R T   O F   C H A P T E R                 %
%                                                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{appendix}


\chapter{A Null Printer Cable for PLIP}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hardware							%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\label{appendix.plip}
To make a Null Printer Cable for use with a PLIP connection, you need
two 25-pin connectors (called DB-25) and some 11-conductor cable.
The cable must be at most 15~meters long.

If you look at the connector, you should be able to read tiny numbers
at the base of each pin, from 1 for the pin top left (if you hold the 
broader side up) to 25 for the pin bottom right. For the Null Printer 
cable, you have to connect the following pins of both connectors
with each other:

{\small
\iftex
 \begin{tabular}{lr@{---}rl}
\else
 \begin{tabular}{lrrl}
\fi
   {\tt D0}	&   2 &  15 & {\tt ERROR}	\\
   {\tt D1}	&   3 &  13 & {\tt SLCT}	\\
   {\tt D2}	&   4 &  12 & {\tt PAPOUT}	\\
   {\tt D3}	&   5 &  10 & {\tt ACK}		\\
   {\tt D4}	&   6 &  11 & {\tt BUSY}	\\
   {\tt GROUND}	&  25 &  25 & {\tt GROUND}	\\
   {\tt ERROR}	&  15 &   2 & {\tt D0}		\\
   {\tt SLCT}	&  13 &   3 & {\tt D1}		\\
   {\tt PAPOUT}	&  12 &   4 & {\tt D2}		\\
   {\tt ACK}	&  10 &   5 & {\tt D3}		\\
   {\tt BUSY}	&  11 &   6 & {\tt D4}
 \end{tabular}
}

\ifinfo
 \begin{verbatim}
   D0        2  ---  15    ERROR        
   D1        3  ---  13    SLCT 
   D2        4  ---  12    PAPOUT       
   D3        5  ---  10    ACK          
   D4        6  ---  11    BUSY 
   GROUND   25  ---  25    GROUND       
   ERROR    15  ---   2    D0           
   SLCT     13  ---   3    D1           
   PAPOUT   12  ---   4    D2           
   ACK      10  ---   5    D3           
   BUSY     11  ---   6    D4
 \end{verbatim}
\fi

All remaining pins remain unconnected. If the cable is shielded,
the shield should be connected to the DB-25's metallic shell
on one end only.


\chapter{Sample \prog{smail} Configuration Files}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sample smail files						%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\label{appendix.smail}

This section shows sample configuration files for a UUCP leaf site on a
local area network. They are based on the sample files included
in the source distribution of \prog{smail-3.1.28}.
Although I make a feeble attempt to explain how these files work,
you are advised to read the very fine \prog{smail(8)} manual page,
which discusses these files in great length. Once you've understood
the basic idea behind \prog{smail} configuration, it's worthwhile
reading. It's easy!


The first file shown is the \file{routers} file, which describes a set of
routers to \prog{smail}.  When \prog{smail} has to deliver a message to
a given address, it hands the address to all routers in turn, until one
of them matches it.  Matching here means that the router finds the
destination host in its database, be it the \file{paths} file,
\file{/etc/hosts}, or whatever routing mechanism the router interfaces
to.


Entries in \prog{smail} configuration files always begin with a unique
name identifying the router, transport, or director.  They are followed
by a list of attributes that define its behavior.  This list consists of
a set of global attributes, such as the \emph{driver} used, and private
attributes that are only understood by that particular driver.
Attributes are separated by commas, while the sets of global and private
attributes are separated from each other using a semicolon.


To make these fine distinctions clear, assume you want to maintain two
separate pathalias files; one containing the routing information for
your domain, and a second one containing global routing information,
probably generatzed from the UUCP maps. With \prog{smail}, you
can now specify two routers in the \file{routers} file, both of
which use the \keyword{pathalias} driver.  This driver looks up hostnames
in a pathalias database. It expects to be given the name of the file
in a private attribute:


\begin{tscreen}
\begin{verbatim}
#
# pathalias database for intra-domain routing
domain_paths: 
        driver=pathalias,         # look up host in a paths file
        transport=uux;            # if matched, deliver over UUCP

        file=paths/domain,        # file is /usr/lib/smail/paths/domain
        proto=lsearch,            # file is unsorted (linear search)
        optional,                 # ignore if the file does not exist
        required=vbrew.com,       # look up only *.vbrew.com hosts

#
# pathalias database for routing to hosts outside our domain
world_paths:  
        driver=pathalias,         # look up host in a paths file
        transport=uux;            # if matched, deliver over UUCP

        file=paths/world,         # file is /usr/lib/smail/paths/world
        proto=bsearch,            # file is sorted with sort(1)
        optional,                 # ignore if the file does not exist
        -required,                # no required domains
        domain=uucp,              # strip ending ".uucp" before searching

\end{verbatim}
\end{tscreen}


The second global attribute given in each of the two \file{routers}
entries above defines the transport that should be used when the router
matches the address.  In our case, the message will be delivered using
the \keyword{uux} transport.  Transports are defined in the
\file{transports} file, which is exlained below.

You can fine-tune by which transport a message will be delivered if you
specify a mathod file instead of the \keyword{transports} attribute.
Method files provide a mapping from target hostnames to transports.
We won't deal with them here.


The following \file{routers} file defines routers for a local area
network that query the resolver library.  On an Internet host, however,
you would want to use a router that handles MX records.  You should
therefore uncomment the alternative \keyword{inet\_bind} router that
uses \prog{smail}'s builtin BIND driver.

In an environment that mixes UUCP and TCP/IP, you may encounterthe
problem that you have hosts in your \file{/etc/hosts} file that
you have only occasional SLIP or PPP contact with.  Usually, you
would still want to send any mail for them over UUCP. To prevent
the \keyword{inet\_hosts} driver from matching these hosts, 
you have to put them into the \file{paths/force} file. This is
another pathalias-style database, and is consulted before \prog{smail}
queries the resolver.



\begin{tscreen}
\begin{verbatim}
# A sample /usr/lib/smail/routers file
#
# force - force UUCP delivery to certain hosts, even when
#       they are in our /etc/hosts
force:
        driver=pathalias,         # look up host in a paths file
        transport=uux;            # if matched, deliver over UUCP

        file=paths/force,         # file is /usr/lib/smail/paths/force
        optional,                 # ignore if the file does not exist
        proto=lsearch,            # file is unsorted (linear search)
        -required,                # no required domains
        domain=uucp,              # strip ending ".uucp" before searching


# inet_addrs - match domain literals containing literal
#       IP addresses, such as in janet@[191.72.2.1]
inet_addrs:
        driver=gethostbyaddr,     # driver to match IP domain literals
        transport=smtp;           # deliver using SMTP over TCP/IP

        fail_if_error,            # fail if address is malformed 
        check_for_local,          # deliver directly if host is ourself

# inet_hosts - match hostnames with gethostbyname(3N)
#       Comment this out if you wish to use the BIND version instead.
inet_hosts:
        driver=gethostbyname,     # match hosts with the library function
        transport=smtp;           # use default SMTP

        -required,                # no required domains
        -domain,                  # no defined domain suffixes
        -only_local_domain,       # don't restrict to defined domains

# inet_hosts - alternate version using BIND to access the DNS
#inet_hosts:
#       driver=bind,              # use built-in BIND driver
#       transport=smtp;           # use TCP/IP SMTP for delivery
#
#       defnames,                 # use standard domain searching
#       defer_no_connect,         # try again if the nameserver is down
#       -local_mx_okay,           # fail (don't pass through) an MX
#                                 # to the local host

#
# pathalias database for intra-domain routing
domain_paths: 
        driver=pathalias,         # look up host in a paths file
        transport=uux;            # if matched, deliver over UUCP

        file=paths/domain,        # file is /usr/lib/smail/paths/domain
        proto=lsearch,            # file is unsorted (linear search)
        optional,                 # ignore if the file does not exist
        required=vbrew.com,       # look up only *.vbrew.com hosts

#
# pathalias database for routing to hosts outside our domain
world_paths:  
        driver=pathalias,         # look up host in a paths file
        transport=uux;            # if matched, deliver over UUCP

        file=paths/world,         # file is /usr/lib/smail/paths/world
        proto=bsearch,            # file is sorted with sort(1)
        optional,                 # ignore if the file does not exist
        -required,                # no required domains
        domain=uucp,              # strip ending ".uucp" before searching


# smart_host - a partically specified smarthost director
#       If the smart_path attribute is not defined in
#       /usr/lib/smail/config, this router is ignored.
#       The transport attribute is overridden by the global
#       smart_transport variable
smart_host:
        driver=smarthost,         # special-case driver
        transport=uux;            # by default deliver over UUCP

        -path,                    # use smart_path config file variable
\end{verbatim}
\end{tscreen}
\medskip


The handling of mail for local addresses is configured in the
\file{directors} file.  It is made up just like the \file{routers} file,
with a list of entries that define a director each.  Directors do
\emph{not} deliver a message, they merely perform all the redirection
that is possible, for instance through aliases, mail forwarding, and the
like.


When delivering mail to a local address, such as \email{janet}, 
\prog{smail} passes the usr name to all directors in turn. If
a director matches, it either specifies a transport the message
should be delivered by (for instance, to the user's mailbox file),
or generates a new address (for instance, after evaluating an
alias).


Because of the security issues involved, directors usually do a lot of
checking of whether the files they use may be compromised or not.
Addresses obtained in a somewhat dubious way (for instance from a
world-writable \file{aliases} file) are flagged as unsecure.  Some
transport drivers will turn down such addresses, for instance the
transport that delivers a message to a file.


Apart from this, \prog{smail} also \emph{associates a user} with each
address.  Any write or read operations are performed as the user.  For
delivery to, say \user{janet}'s mailbox, the address is of course
associated with \user{janet}.  Other addresses, such as those obtained
from the \file{aliases} file, have other users associated from them, for
instance, the \user{nobody} user.


For details of these features, please refer to the \file{smail(8)}
manpage.


\medskip
\begin{tscreen}
\begin{verbatim}
# A sample /usr/lib/smail/directors file

# aliasinclude - expand ":include:filename" addresses produced
#       by alias files
aliasinclude:
        driver=aliasinclude,      # use this special-case driver
        nobody;                   # access file as nobody user if unsecure

        copysecure,               # get permissions from alias director
        copyowners,               # get owners from alias director

# forwardinclude - expand ":include:filename" addrs produced
#       by forward files
forwardinclude:
        driver=forwardinclude,    # use this special-case driver
        nobody;                   # access file as nobody user if unsecure

        checkpath,                # check path accessibility
        copysecure,               # get perms from forwarding director
        copyowners,               # get owners from forwarding director

# aliases - search for alias expansions stored in a database
aliases:
        driver=aliasfile,         # general-purpose aliasing director
        -nobody,                  # all addresses are associated
                                  # with nobody by default anyway
        sender_okay,              # don't remove sender from expansions
        owner=owner-$user;        # problems go to an owner address

        file=/usr/lib/aliases,    # default: sendmail compatible
        modemask=002,             # should not be globally writable
        optional,                 # ignore if file does not exist
        proto=lsearch,            # unsorted ASCII file

# dotforward - expand .forward files in user home directories
dotforward:
        driver=forwardfile,       # general-purpose forwarding director
        owner=real-$user,         # problems go to the user's mailbox
        nobody,                   # use nobody user, if unsecure
        sender_okay;              # sender never removed from expansion

        file=~/.forward,          # .forward file in home directories
        checkowner,               # the user can own this file
        owners=root,              # or root can own the file
        modemask=002,             # it should not be globally writable
        caution=0-10:uucp:daemon, # don't run things as root or daemons
        # be extra careful of remotely accessible home directories
        unsecure="~ftp:~uucp:~nuucp:/tmp:/usr/tmp",

# forwardto - expand a "Forward to " line at the top of
#       the user's mailbox file
forwardto:
        driver=forwardfile,
        owner=Postmaster,         # errors go to Postmaster
        nobody,                   # use nobody user, if unsecure
        sender_okay;              # don't remove sender from expansion

        file=/var/spool/mail/${lc:user}, # location of user's mailbox
        forwardto,                # enable "Forward to " check
        checkowner,               # the user can own this file
        owners=root,              # or root can own the file
        modemask=0002,            # under System V, group mail can write
        caution=0-10:uucp:daemon, # don't run things as root or daemons

# user - match users on the local host with delivery to their mailboxes
user:   driver=user;              # driver to match usernames

        transport=local,          # local transport goes to mailboxes

# real_user - match usernames when prefixed with the string "real-"
real_user:
        driver=user;              # driver to match usernames

        transport=local,          # local transport goes to mailboxes
        prefix="real-",           # for example, match real-root

# lists - expand mailing lists stored below /usr/lib/smail/lists
lists:  driver=forwardfile,
        caution,                  # flag all addresses with caution
        nobody,                   # and then associate the nobody user
        sender_okay,              # do NOT remove the sender
        owner=owner-$user;        # the list owner

        # map the name of the mailing list to lower case
        file=lists/${lc:user},
\end{verbatim}
\end{tscreen}
\medskip


After successfully routing or directing a message, \prog{smail}
hands the message to the transport specified by the router
or director that matched the address. These transports are
defined in the \file{transports} file. Again, a transport
is defined by a set of global and private options.


The most important option defined by each entry is driver that handles
the transport, for instance the \keyword{pipe} driver, which invokes the
command specified in the \keyword{cmd} attribute.  Apart from this,
there are a number of global attributes a transport may use, that
perform various transformations on the message header, and possibly
message body.  The \keyword{return\_path} attribute, for instance, makes
the transport insert a \file{return\_path} field in the message header
The \keyword{unix\_from\_hack} attribute makes it precede every
occurrence of the word \term{From} at the beginning of a line with a
\term{$>$} sign.


\medskip
\begin{verbatim}
# A sample /usr/lib/smail/transports file

# local - deliver mail to local users
local:  driver=appendfile,        # append message to a file
        return_path,              # include a Return-Path: field
        from,                     # supply a From_ envelope line
        unix_from_hack,           # insert > before From in body
        local;                    # use local forms for delivery

        file=/var/spool/mail/${lc:user}, # location of mailbox files
        group=mail,               # group to own file for System V
        mode=0660,                # group mail can access
        suffix="\n",              # append an extra newline

# pipe - deliver mail to shell commands
pipe:   driver=pipe,              # pipe message to another program
        return_path,              # include a Return-Path: field
        from,                     # supply a From_ envelope line
        unix_from_hack,           # insert > before From in body
        local;                    # use local forms for delivery

        cmd="/bin/sh -c $user", # send address to the Bourne Shell
        parent_env,               # environment info from parent addr
        pipe_as_user,             # use user-id associated with address
        ignore_status,            # ignore a non-zero exit status
        ignore_write_errors,      # ignore write errors, i.e., broken pipe
        umask=0022,               # umask for child process
        -log_output,              # do not log stdout/stderr

# file - deliver mail to files
file:   driver=appendfile,
        return_path,              # include a Return-Path: field
        from,                     # supply a From_ envelope line
        unix_from_hack,           # insert > before From in body
        local;                    # use local forms for delivery

        file=$user,               # file is taken from address
        append_as_user,           # use user-id associated with address
        expand_user,              # expand ~ and $ within address
        suffix="\n",              # append an extra newline
        mode=0600,                # set permissions to 600

# uux - deliver to the rmail program on a remote UUCP site
uux:    driver=pipe,
        uucp,                     # use UUCP-style addressing forms
        from,                     # supply a From_ envelope line
        max_addrs=5,              # at most 5 addresses per invocation
        max_chars=200;            # at most 200 chars of addresses

        cmd="/usr/bin/uux - -r -a$sender -g$grade $host!rmail $(($user)$)",
        pipe_as_sender,           # have uucp logs contain caller
        log_output,               # save error output for bounce messages
#       defer_child_errors,       # retry if uux returns an error

# demand - deliver to a remote rmail program, polling immediately
demand: driver=pipe,
        uucp,                     # use UUCP-style addressing forms
        from,                     # supply a From_ envelope line
        max_addrs=5,              # at most 5 addresses per invocation
        max_chars=200;            # at most 200 chars of addresses

        cmd="/usr/bin/uux - -a$sender -g$grade $host!rmail $(($user)$)",
        pipe_as_sender,           # have uucp logs contain caller
        log_output,               # save error output for bounce messages
#       defer_child_errors,       # retry if uux returns an error

# hbsmtp - half-baked BSMTP. The output files must
#       be processed regularly and sent out via UUCP.
hbsmtp: driver=appendfile,
        inet,                     # use RFC 822-addressing
        hbsmtp,                   # batched SMTP w/o HELO and QUIT
        -max_addrs, -max_chars;   # no limit on number of addresses

        file="/var/spool/smail/hbsmtp/$host",
        user=root,                # file is owned by root
        mode=0600,                # only read-/writeable by root.

# smtp - deliver using SMTP over TCP/IP
smtp:   driver=tcpsmtp,
        inet,
        -max_addrs, -max_chars;   # no limit on number of addresses

        short_timeout=5m,               # timeout for short operations
        long_timeout=2h,                # timeout for longer SMTP operations
        service=smtp,                   # connect to this service port
# For internet use: uncomment the below 4 lines
#       use_bind,                       # resolve MX and multiple A records
#       defnames,                       # use standard domain searching
#       defer_no_connect,               # try again if the nameserver is down
#       -local_mx_okay,                 # fail an MX to the local host
\end{verbatim}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The GNU Public License                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{The GNU General Public License}
\label{appendix.gpl}

\input{gpl.tex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The BSD License                                        	%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \chapter{The BSD License}
% \label{appendix.bsd-license}
% {\bf [Meta: The BSD License should go here; possibly other major
% \linux-related licenses as well.]}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                               %
%                 E N D   O F   C H A P T E R                   %
%                                                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{appendix}
